﻿
#Region "Using Directives"

Imports System
Imports System.Collections.Generic
Imports System.Text

#End Region

Namespace C4F.DevKit.Bluetooth

    Namespace ServiceAndDeviceDiscovery

        ''' <summary>
        ''' Defines the Connection Event Arguments for the Connected Event.
        ''' </summary>
        Public Class ConnectionEventArgs
            Inherits ComponentModel.AsyncCompletedEventArgs

#Region "Private Members"

            ''' <summary>
            ''' Represents a network stream for communication with remote 
            ''' service.
            ''' </summary>
            Private servStream As Net.Sockets.NetworkStream

#End Region

#Region "Public Property"

            ''' <summary>
            ''' Gets the service stream.
            ''' </summary>
            Public ReadOnly Property ServiceStream() As Net.Sockets.NetworkStream

                Get
                    RaiseExceptionIfNecessary()
                    Return Me.servStream
                End Get

            End Property

#End Region

#Region "Constructor"

            ''' <summary>
            ''' Initializes the ConnectionEventArgs object.
            ''' </summary>
            ''' <param name="serviceStream">Network Stream used for 
            ''' communication with remote service.</param>
            ''' <param name="e">An error that occurred during the 
            ''' asynchronous operation.</param>
            ''' <param name="canceled">A value indicating whether the 
            ''' asynchronous operation was cancelled.</param>
            ''' <param name="state">The user-supplied state object supplied
            ''' when the asynchronous operation was requested.</param>
            Public Sub New(ByVal serviceStream As Net.Sockets.NetworkStream, ByVal e As Exception, ByVal canceled As Boolean, _
                            ByVal state As Object)

                MyBase.New(e, canceled, state)
                Me.servStream = serviceStream

            End Sub

#End Region

        End Class

    End Namespace
End Namespace
